package com.ruoyi.yljf.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.yljf.mapper.BookmarkMapper;
import com.ruoyi.yljf.domain.Bookmark;
import com.ruoyi.yljf.service.IBookmarkService;

/**
 * 书签Service业务层处理
 * 
 * @author metaee
 * @date 2025-02-12
 */
@Service
public class BookmarkServiceImpl extends ServiceImpl<BookmarkMapper, Bookmark> implements IBookmarkService {
    @Autowired
    private BookmarkMapper bookmarkMapper;
    
    /**
     * 查询书签列表
     * 
     * @param bookmark 书签
     * @return 书签
     */
    @Override
    public List<Bookmark> selectBookmarkList(Bookmark bookmark) {
    	LambdaQueryWrapper<Bookmark> queryWrapper = Wrappers.lambdaQuery();
        if (StringUtils.isNotNull(bookmark.getChapterId())) {
			queryWrapper.eq(Bookmark::getChapterId, bookmark.getChapterId());
		}
        if (StringUtils.isNotNull(bookmark.getUserId())) {
			queryWrapper.eq(Bookmark::getUserId, bookmark.getUserId());
		}
        if (StringUtils.isNotNull(bookmark.getArticleId())) {
			queryWrapper.eq(Bookmark::getArticleId, bookmark.getArticleId());
		}
        return bookmarkMapper.selectList(queryWrapper);
    }
}
